package com.retail.order.remote.factory;

import com.retail.common.core.domain.Result;
import com.retail.order.remote.OrderRemoteService;
import com.retail.order.vo.OrderRequest;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author: 靳家振
 * @Date: 2024/3/7 10:44
 * @Description:
 **/

@Component
public class OrderRemoteFallbackFactory implements FallbackFactory<OrderRemoteService> {
    @Override
    public OrderRemoteService create(Throwable cause) {
        return new OrderRemoteService () {
            @Override
            public Result getOrderId(OrderRequest orderRequest) {
                return Result.error ("下单服务异常，请稍后再试");
            }
        };
    }
}
